package cn.com.cpic.insurance.rulecheck.util;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import cn.com.cpic.insurance.rulecheck.consumer.BooleanResult;

public class ResultUtils {

	public static String booleanResultToJson(BooleanResult result) throws JSONException {
		JSONObject jo = new JSONObject();
		jo.put("result", result.getResult());
		JSONArray ja = new JSONArray();
		for (String message : result.getMessages()) {
			ja.put(message);
		}
		jo.put("message", ja);
		return jo.toString();
	}
}
